﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;

namespace Timeline
{
    public class TimelineValue
    {
        #region Member variables

        private int _fromYear;
        private int _toYear;
        private string _backgroundCssClass;
        private string _toolTip;
        private string _onClickJS;

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets from year.
        /// </summary>
        /// <value>
        /// From year.
        /// </value>
        [Bindable(true), Category("Values"), DefaultValue("1990"), Description("From year.")]
        public int FromYear
        {
            get { return _fromYear; }
            
            set 
            {
                if (value < 0)
                    throw new ArgumentException("Value cannot be lower then 0!");

                _fromYear = value; 
            }
        }

        /// <summary>
        /// Gets or sets to year.
        /// </summary>
        /// <value>
        /// To year.
        /// </value>
        [Bindable(true), Category("Values"), DefaultValue("2000"), Description("To year.")]
        public int ToYear
        {
            get { return _toYear; }
            
            set 
            {
                if (value < 0)
                    throw new ArgumentException("Value cannot be lower then 0!");

                _toYear = value; 
            }
        }

        /// <summary>
        /// Gets or sets the background CSS class.
        /// </summary>
        /// <value>
        /// The background CSS class.
        /// </value>
        [Bindable(true), Category("Values"), DefaultValue(""), Description("Css class to use for setting background color.")]
        public string BackgroundCssClass
        {
            get { return _backgroundCssClass; }
            set { _backgroundCssClass = value; }
        }

        /// <summary>
        /// Gets or sets the tool tip.
        /// </summary>
        /// <value>
        /// The tool tip.
        /// </value>
        [Bindable(true), Category("Values"), DefaultValue(""), Description("Tool tip.")]
        public string ToolTip
        {
            get { return _toolTip; }
            set { _toolTip = value; }
        }

        /// <summary>
        /// Gets or sets the on click js.
        /// </summary>
        /// <value>
        /// The on click js.
        /// </value>
        [Bindable(true), Category("Values"), DefaultValue(""), Description("OnClick javascript.")]
        public string OnClickJS
        {
            get { return _onClickJS; }
            set { _onClickJS = value; }
        }

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="TimelineValue"/> class.
        /// </summary>
        public TimelineValue()
        {

        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TimelineValue" /> class.
        /// </summary>
        /// <param name="fromYear">From year.</param>
        /// <param name="toYear">To year.</param>
        /// <param name="backgroundCssClass">The background CSS class.</param>
        /// <param name="tooltip">The tooltip.</param>
        /// <param name="onClickJS">The on click js.</param>
        public TimelineValue(int fromYear, int toYear, string backgroundCssClass, string tooltip, string onClickJS)
        {
            FromYear = fromYear;
            ToYear = toYear;
            BackgroundCssClass = backgroundCssClass;
            ToolTip = tooltip;
            OnClickJS = OnClickJS;
        }

        #endregion
    }
}